/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package psexecute;
import java.io.*;
/**
 *
 * @author Gerratana Francesco
 */
public class LeggiFile extends FileReader
{
   
   //Nuova Versione con Ereditarietà
    public LeggiFile(String path) throws FileNotFoundException
    {
        super(path);
    }
    
    /* Vecchia Versione
    private FileReader fr;


    public LeggiFile(String path) throws FileNotFoundException{

        this.fr = new FileReader(path);

    }
     Fine Vecchia Versione*/

    public String leggi() throws IOException {

        /* Vecchia versione
        BufferedReader file = new BufferedReader(fr);
         * Vecchia Versione
         */

        //Nuova Versione
        BufferedReader file = new BufferedReader(this);
        String line = null;
        StringBuilder outputString = new StringBuilder();

        while ((line = file.readLine()) != null)
            outputString.append(line).append("\n");

        return outputString.toString();
    }
}
